package util

import (
	"fmt"
	"math/rand"
	"time"
)

func RandomArray(maxlength int) []int {
	rand.Seed(time.Now().UnixNano())

	length := rand.Intn(maxlength + 1)

	// 创建一个指定长度的数组
	arr := make([]int, length)

	// 生成-10000到10000之间的随机整数并填充到数组中
	for i := 0; i < length; i++ {
		arr[i] = rand.Intn(100)
	}
	fmt.Println("RandomArray: ", arr, length)
	return arr
}
